{template header}


{template sidebar}

<!-- artile begin -->
<div class="article">
    <div class="tab">
        <ul>
            <!--{loop $this->tab $k $v}-->
            <li {$k == $type ? ' class="current"' : ''}><a href="{$this->url( $c, null, array( 'type' => $k ) )}">{$v}</a></li>
            <!--{/loop}-->
        </ul>
    </div>


    <!--{if $type == 'myOrder' }-->
    <form class="form-search" action="{$this->url($c, 'search_myorder', $this->get())}">
        <table>
            <tr><td class="td1" width="20%">淘宝单号：</td>
                <td>

                    <div class="input-append">
                        <input type="text" name="key" class="span2 search-query" id="stockNo" placeholder=""请输入出库单号 />
                        <button type="button" class="btn search">搜索</button>
                        <td>
                            <button type="button" onclick="totalOutStock(0)"> 出库预览</button></td>
                        <td><button type="button" onclick="totalOutStock(1)"> 汇总出库</button></td>
                    </div>
                </td >
            </tr>
        </table>

    </form>
    <table cellpadding="1" cellspacing="1" width="100%" border="0">

        <tr>

            <th width="10%">淘宝单号</th>
            <th width="10%">商品编号</th>
            <th width="25%">宝贝名称</th>
            <th width="10%">颜色</th>
            <th width="10%">尺码</th>
            <th width="25%">操作</th>

        </tr>
        <!--{if $result}-->
        <!--{loop $result $t}-->

        <tr>
            <td>{$t['taobaoOrderNo']}</td>
            <td>{$t['goodsNo']}</td>
            <td>{$t['goodsName']}</td>
            <td>{$t['color']}</td>
            <td>{$t['size']}</td>
            <td class="operate">

                <!--{if  $t['orderStatus'] ==0}-->
                <a href="{$this->url($c,'postGoods',array('orderNo'=>$t['orderNo']))}">发货</a>
                <a href="{$this->url($c,'postGoods',array('orderNo'=>$t['orderNo']))}">缺货流转</a>
                <a href="{$this->url($c,'postGoods',array('orderNo'=>$t['orderNo']))}">缺货关闭</a>
                <!--{/if}-->

                <!--{if  $t['orderStatus'] == 1}-->
                <a href="{$this->url($c,'evaluateGoods',array('orderNo'=>$t['orderNo']))}">评论</a>
                <a href="{$this->url($c,'backGoods',array('orderNo'=>$t['orderNo']))}">换货</a>
                <a href="{$this->url($c,'cancelGoods',array('orderNo'=>$t['orderNo']))}">退货</a>
                <!--{/if}-->

            </td>
        </tr>

        <!--{/loop}-->

        <!--{else}-->
        <tr>

            <td colspan="5">没有数据记录文件！</td>

        </tr>
        <!--{/if}-->

        <!--{if $pager}-->
        <!--分页开始-->
        <tr>
            <td colspan="4">
                <div class="page">{$pager}</div>
            </td>
        </tr>
        <!--分页结束-->
        <!--{/if}-->



    </table>

    <script >
        function  totalOutStock(v)
        {
            var url = "{$this->url('totalOutStock', 'lookTotalStock')}";
            url = url + "&inOutStockType=" + v + "&inOutStockNo="+ window.document.getElementById("stockNo").value;
            //window.location.href = url;
            window.open(url);
        }
    </script>

    <!--{/if}-->



    <!--{if $type == 'orderMan' }-->
    <form class="form-search" action="{$this->url($c, 'search_order', $this->get())}">
        <table>
            <tr><td class="td1" width="20%">淘宝编号：</td>
                <td>

                    <div class="input-append">
                        <input type="text" name="key" class="span2 search-query" placeholder=""请输入出库单号 />
                        <button type="button" class="btn search">搜索</button>
                    </div>
                </td >
            </tr>
        </table>

    </form>

    <table cellpadding="1" cellspacing="1" width="100%" border="0">
        <tr>

            <th width="20%">淘宝单号</th>
            <th width="30%">宝贝名称</th>
            <th width="15%">订单日期</th>
            <th width="10%">订单状态</th>
            <th width="20%">操作</th>
        </tr>
        <!--{if $result}-->
        <!--{loop $result $val}-->
        <tr>
            <td>{$val['taobaoOrderNo']}</td>
            <td>{$val['goodsName']}</td>
            <td>{$val['dateCreate']}</td>
            <td>{$val['orderStatus']}</td>
            <td class="operate">
                <a href="{$this->url($c,'editOrder',array('orderNo'=>$val['orderNo']))}">编辑</a>
                <a href="{$this->url($c,'del', array('orderNo'=>$val['orderNo']))}">删除</a>
            </td>
        </tr>

        <!--{/loop}-->

        <!--{else}-->
        <tr>

            <td colspan="5">没有数据记录文件！</td>

        </tr>
        <!--{/if}-->

        <!--{if $pager}-->
        <!--分页开始-->
        <tr>
            <td colspan="4">
                <div class="page">{$pager}</div>
            </td>
        </tr>
        <!--分页结束-->
        <!--{/if}-->

        <tr>
            <td colspan="5" class="td4">
                <a title="添加订单" class="btn btn-success " href="{$this->url($c,'addOrder')}">添加订单</a>
            </td>
        </tr>

    </table>


    <!--{/if}-->

    <!--{if  $a == 'addOrder' || $a == 'editOrder'}-->
    <form method="post" action="{$this->url($c, 'save')}">

        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <th colspan="4" class="td2">{$a == 'addOrder' ? '添加' : '修改'}订单</th>
            </tr>
            <!--{if $a == 'add'}-->

            <tr>
                <td class="td1">订单编号：</td>
                <td class="td2" colspan="2"><input type="text" placeholder="请输入订单编号" size="30" name="orderNo" value = "{result['orderNo']}" class="required" /></td>
            </tr>
            <!--{/if}-->
            <tr>
                <td class="td1">商品编号：</td>
                <td class="td2" colspan="3"><input type="text" id="goodsNo"  placeholder="请输入商品编号" size="30"   value = "{$result['goodsNo']}" name="goodsNo" onchange="change(this.value)" /> </td>
            </tr>
            <tr>
                <td class="td1">货号：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="materialNo" value="{$result['materialNo']}" />
                </td>
            </tr>
            <tr>
                <td class="td1">宝贝名称：</td>
                <td class="td2" colspan="3"><input type="text" placeholder="请输入密码" size="30" name="goodsName" value = "{$result['goodsName']}" class="required" /></td>
            </tr>
            <script>
                function change(v){
                    var url ="{$this->url($c,'addOrder')}";

                   window.location.href = url + "&goodsNo=" + v;

                }
            </script>
            <tr>
                <td class="td1">淘宝订单号：</td>
                <td class="td2" colspan="3"><input type="text" placeholder="请输入密码" size="30" name="taobaoOrderNo" value = "{$result['taobaoOrderNo']}" class="required" /></td>
            </tr>

            <tr>
                <td class="td1">买家旺旺ID：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="wwID" value="{$result['wwID']}" />
                </td>

            </tr>
            <tr>
                <input type="hidden" name="editMode" value="{$result['editMode']}" />
                <input type="hidden" name="orderNo" value="{$result['orderNo']}" />
            </tr>

            <tr>
                <td class="td1">买家所在地：</td>
                <td class="td2" colspan="3">
                    <select name="cusAddr" id="templateId" onchange="templateChange(this.value)">
                        <!--{loop $this->area $k $v}-->
                        <option value="{$k}" {echo $result['cusAddr'] == $k ?  'selected' : '' }  >{$v}</option>
                        <!--{/loop}-->
                    </select>
                </td>
            </tr>

            <tr>
                <td class="td1">收件地址：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="recvAddr" value="{$result['recvAddr']}" />
                </td>
            </tr>
            <tr>
                <td class="td1">联系电话：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="phone" value="{$result['phone']}" />
                </td>
            </tr>

            <tr>
                <td class="td1">颜色：</td>
                <td class="td2" colspan="3">
                    <select name="color" >
                        <!--{loop $color  $k $v}-->
                        <option value="{$v['color']}" {$v['color'] == $result['color']?'selected':''}>{$this->color[$v['color']]}</option>
                        <!--{/loop}-->
                    </select>
                </td>
            </tr>
            <tr>
                <td class="td1">尺寸：</td>
                <td class="td2" colspan="3">
                    <select name="size" >
                        <!--{loop $size  $v}-->
                        <option value="{$v['size']}" {$v['size'] == $result['size']?'selected':''}>{$this->size[$v['size']]}</option>
                        <!--{/loop}-->
                    </select>
                </td>
            </tr>
            <tr>
                <td class="td1">销售数量：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="amount" value="{$result['amount']}" />
                </td>
            </tr>
            <tr>
                <td class="td1">销售单价：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="price" value="{$result['price']}" />
                </td>
            </tr>
            <tr>
                <td class="td1">运费价格：</td>
                <td class="td2" colspan="3">
                    <input type="text" size="30" name="logisticPrice" value="{$result['logisticPrice']}" />
                </td>
            </tr>
            <tr>
                <td colspan="2" class="td1">
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">保存</a>
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">重置</a>
                </td>
            </tr>
        </table>
    </form>
    <!--{/if}-->



    <!--{if  $a == 'postGoods' }-->
    <form method="post" action="{$this->url($c, 'savePost')}">
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
           <tr>
                <td class="td1">订单编号：</td>
                <td class="td2" colspan="2"><input type="text" placeholder="请输入订单编号" size="30" name="goodsNo" value = "{$result['orderNo']}" class="required" /></td>
            </tr>
            <tr>
                <td class="td1">物流公司：</td>

                <td class="td2" colspan="2">
                    <select name="logisticId"  >
                        <!--{loop $res $k $v}-->
                        <option value="{$v['companyNo']}" {echo $result['logisticId'] == $v['companyNo']?  'selected' : '' }  >{$v['companyName']}</option>
                        <!--{/loop}-->
                    </select>
                </td>
            </tr>
            <tr>
                <td class="td1">快递单号：</td>
                <td class="td2" colspan="2">
                    <input type="text" size="30" name="logisticNo" value="{$a == 'edit' ? $result['logisticNo'] : ''}" />
                </td>
            </tr>
            <tr>
                <td class="td1">运    费：</td>
                <td class="td2" colspan="2">
                    <input type="text" size="30" name="logisticCost" value="{$a == 'edit' ? $result['logisticCost'] : ''}" />
                </td>
            </tr>
            <tr>
                <td colspan="1" class="td1">
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">保存</a>
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">重置</a>
                </td>
            </tr>
        </table>
    </form>
    <!--{/if}-->

    <!--{if  $a == 'evaluateGoods' }-->
    <form method="post" action="{$this->url($c, 'saveEvaluate', array('id' => $result['id']) )}">
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
           <tr>
                <td class="td1">订单编号：</td>
                <td class="td2" colspan="2"><input type="text" placeholder="请输入订单编号" size="30" name="orderNo" value = "{$result['orderNo']}" class="required" /></td>
            </tr>
            <tr>
                <td class="td1">评价类型：</td>
                <td class="td2" colspan="2">
                    <input type="text" size="30" name="type" value="{$a == 'edit' ? $result['type'] : ''}" />
                </td>
            </tr>
            <tr>
                <td class="td1">评论内容：</td>
                <td class="td2" colspan="2">
                    <textarea name="content" placeholder="请输入SQL语句" cols="50" rows="5" class="required"></textarea>
                </td>
            </tr>

            <tr>
                <td colspan="1" class="td1">
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">保存</a>
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">重置</a>
                </td>
            </tr>
        </table>
    </form>
    <!--{/if}-->

    <!--{if  $a == 'backGoods' }-->
    <form method="post" action="{$this->url($c, 'saveBack')}">
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <td class="td1">订单编号：</td>
                <td class="td2" colspan="2"><input type="text" placeholder="请输入订单编号" size="30" name="orderNo" value = "{$result['orderNo']}" class="required" /></td>
            </tr>

            <tr>
                <td class="td1">换货原因类型：</td>
                <td class="td2" colspan="2">
                    <input type="text" size="30" name="reason" value="{$a == 'edit' ? $result['reason'] : ''}" />
                </td>
            </tr>
            <tr>
                <td class="td1">换货原因：</td>
                <td class="td2" colspan="2">
                    <textarea name="content" placeholder="请输入原因" cols="50" rows="5" class="required"></textarea>
                </td>
            </tr>

            <tr>
                <td colspan="1" class="td1">
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">保存</a>
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">重置</a>
                </td>
            </tr>
        </table>
    </form>
    <!--{/if}-->
    <!--{if  $a == 'cancelGoods' }-->
    <form method="post" action="{$this->url($c, 'saveCancel', array('id' => $result['id']) )}">
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <td class="td1">订单编号：</td>
                <td class="td2" colspan="2"><input type="text" placeholder="请输入订单编号" size="30" name="orderNo" value = "{$result['orderNo']}" class="required" /></td>
            </tr>
            <tr>
                <td class="td1">退货原因类型：</td>
                <td class="td2" colspan="2">
                    <input type="text" size="30" name="reason" value="{$a == 'edit' ? $result['reason'] : ''}" />
                </td>
            </tr>
            <tr>
                <td class="td1">退货原因：</td>
                <td class="td2" colspan="2">
                    <textarea name="content" placeholder="请输入退货原因" cols="50" rows="5" class="required"></textarea>
                </td>
            </tr>

            <tr>
                <td colspan="1" class="td1">
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">保存</a>
                </td>
                <td colspan="1" class="td1">
                    <a class="btn btn-success green save" href="{$this->url($c)}">重置</a>
                </td>
            </tr>
        </table>
    </form>
    <!--{/if}-->




</div>
<!-- artile end -->
{template footer}